﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Windows.Forms;

namespace ResumeHelper
{
    public class Util
    {
        public static bool isEmail(string inputEmail)
        {
            EmailAddress email = new EmailAddress(inputEmail);

            return email.IsValid;

        }

        public static string NullToString(string strData)
        {
            if (strData == null)
            {
                return "";
            }
            else
            {
                return strData;
            }
        }

        public static void ShowInfoMessage(string strMsg)
        {
            MessageBox.Show(strMsg, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
        }

        public static void HighLightControl(Control con)
        {
            if (con.GetType() == typeof(TextBox))
            {
                TextBox txt = con as TextBox;
                con.Focus();
                txt.SelectAll();
            }
            
        }

        public static bool IsPassword(string strData)
        {
            Regex re = new Regex(@"^[A-Za-z0-9]+$");
            return re.IsMatch(strData);
        }

    }
}
